<template>
  <div>
    <room-show :type-map="typeMap" :room-list="roomList"></room-show>
  </div>
</template>

<script>
import RoomShow from "@/components/RoomShow";
import {getRoomList} from "@/api/RoomApi";
import {getTypeList} from "@/api/TypeApi";

export default {
  name: "AllRoom",
  data(){
    return{
      roomList: [],
      typeMap: new Map()
    }
  },
  components: {
    RoomShow
  },
  created() {
    getTypeList().then(res => {
      let typeList = res['data']
      typeList.forEach(t => {
        this.typeMap.set(t['id'], t)
      })
      getRoomList().then(res => {
        this.roomList = res['data']
      })
    })
  }
}
</script>

<style scoped>

</style>
